module Addition.Lib
    (genOperand, output) where

import Data.List

genOperand :: IO ()
genOperand = putStrLn "add genOperand..."

gen :: Int -> [(Int,Int)]
gen n = do
    x <- [0..n]
    y <- [0..x]
    let c = return (x, y)
    let d = return (y, x)
    let e = nub (c ++ d)
    filter p e where 
        p = \(a, b) -> a + b <= n

fmt :: Bool -> [(Int, Int)] -> [String]
fmt flag = map (\(a, b) -> (show a) ++ "+" ++ (show b) ++ (answer flag a b)) where 
    answer :: Bool -> Int -> Int -> String
    answer flag a b
        | flag == True = "=" ++ (show $ a + b)
        | otherwise = "="

output :: Bool -> Int -> [String]
output flag = fmt flag . gen 
-- genOperand :: NonNegative -> ArithmeticExp
-- genOperand NonNegative n = do
    -- return
     
